home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2008 November / PCWNOV08.iso / Software / Freeware / NoteTab Light 5.7 / NoteTab_Setup.exe / {app} / Libraries / Utilities.clb < prev    next >
Encoding:
Text File  |  2008-07-15  |  47.9 KB  |  1,175 lines

  1. = V5 MultiLine NoSorting TabWidth=30
  2.  
  3. H=";About this library"
  4. This library was written by Fookes Software to serve as a demonstration of the varied tasks that can be performed by the Editor Clipbook. You are free to customize it any way you like!
  5.  
  6. You can get more information about each Clip, and how they should be used, by double-clicking on their colored section title.
  7.  
  8.  
  9. H=";"
  10.  
  11.  
  12. H=";Clipbook Manager"
  13. Below, you will find a brief explanation about each Clip under this topic.
  14.  
  15. 1) Switch Library:
  16. Provides an alternative way to switch to another Clipbook library, and optionally hide the list.
  17.  
  18. 2) Install Libraries:
  19. Use this Clip to install libraries stored in other directories or disks. For example, libraries downloaded from the Internet or copied to a diskette from another computer. The Clip will copy the chosen libraries to NoteTab's Libraries subdirectory.
  20.  
  21. 3) Remove Libraries:
  22. You might have some libraries you created for temporary purposes, or that you downloaded from the Internet to try out but don't want to keep. This Clip makes it easy to remove those libraries. It sends them to the Windows recycle bin.
  23.  
  24.  
  25. H="Switch Library"
  26. ;Store list of library names in the variable LibraryList
  27. ^!Clip FillLibraryList
  28.  
  29. ;Show Clip wizard
  30. ^!Set %ShowClipbook%=^?{(T=C)Show Clipbook window?==_Yes|No}; %LibraryName%=^?{(H=10)Choose a library==_^%LibraryList%}
  31. ;Show or hide Clipbook window based on user's choice
  32. ^!ShowClipbook ^%ShowClipbook%
  33. ;Open chosen library. Remove first space character added by FillLibraryList Clip
  34. ^!LoadLibrary ^$StrDelete("^%LibraryName%";1;1)$
  35. ^!IfError Next ELSE Skip
  36. ^!Prompt Error: could not open "^%LibraryName%"
  37.  
  38.  
  39. H="Install Libraries"
  40. ;Clear variable in case it has been used previously
  41. ^!ClearVariable %LibraryList%
  42. ;Get value of last install directory from INI file, if available
  43. ^!Set %LibraryInstallPath%=^$GetValue(LibraryInstallPath)$
  44. ;Initialize variable for library search directory if it is empty
  45. ^!IfTrue ^$IsEmpty(^%LibraryInstallPath%)$ Next ELSE Skip
  46. ^!Set %LibraryInstallPath%=^$GetTmpPath$
  47.  
  48. ;Get library names to install
  49. ^!SetArray %LibraryNames%=^?{(T=O;S=M;F="Clipbook libraries (*.clb)|*.clb")Select libraries to install (no wildcards)=^%LibraryInstallPath%}
  50. ;Copy the value representing the number of items into the Count variable. The variable at index 0 indicates the number of items in the array
  51. ^!Set %Count%=^%LibraryNames0%
  52. ;If no files were chose, leave the loop
  53. ^!If ^%Count% = 0 Exit
  54. ;Check if first file exists; end the Clip if it doesn't
  55. ^!IfFileExist "^%LibraryNames1%" Continue ELSE Next
  56. ^!Prompt Error: "^%LibraryNames1%" not found
  57. ^!Goto Exit
  58.  
  59. :Continue
  60. ;Get path of libraries to install
  61. ^!Set %LibraryInstallPath%=^$GetPath("^%LibraryNames1%")$
  62. ;If path is same as libraries directory, then they are already installed so end Clip
  63. ^!IfSame "^%LibraryInstallPath%" "^$GetLibraryPath$" Exit
  64. ;Save install directory to INI file for eventual reuse
  65. ^!SaveValue LibraryInstallPath=^%LibraryInstallPath%
  66.  
  67. ;Initialize the Index variable to 0
  68. ^!Set %Index%=0
  69.  
  70. ;Beginning of loop
  71. :StartLoop
  72. ;Add one to the value contained in the variable Index
  73. ^!Inc %Index%
  74. ;End the Clip if the Index number is greater than the Count number
  75. ^!If ^%Index% > ^%Count% EndLoop
  76. ;Copy the library file name corresponding to the current index value to a variable. The content of the array's indexed variable is used here
  77. ^!Set %LibraryName%=^%LibraryNames^%Index%%
  78. ;Check if chosen library really exists
  79. ^!IfFileExist "^%LibraryName%" Next ELSE NotFound
  80. ;Check if library already exists in Libraries directory
  81. ^!IfFileExist "^$GetLibraryPath$^$GetFileName("^%LibraryName%")$" Next ELSE CopyLibrary
  82. ;Prompt user if library already exists and is going to be overwritten
  83. ^!Skip "^$GetFileName("^%LibraryName%")$" is already installed. Overwrite it?
  84. ;Jump back to the start of the loop if user answers no
  85. ^!Goto StartLoop
  86.  
  87. :CopyLibrary
  88. ;Copy library into Libraries directory
  89. ^!CopyFile "^%LibraryName%" "^$GetLibraryPath$"
  90. ;Append library name without path and extension to variable. Name is preceded with a space in case it starts with a special character. This space will have to be removed later
  91. ^!Append %LibraryList%= ^$GetName("^%LibraryName%")$|
  92. ;Jump back to the start of the loop
  93. ^!Goto StartLoop
  94.  
  95. :NotFound
  96. ^!Prompt Error: "^%LibraryName%" not found
  97. ^!Goto StartLoop
  98.  
  99. :EndLoop
  100. ^!Refresh
  101.  
  102. ;Get size of library list
  103. ^!Set %SizeList%=^$StrSize("^%LibraryList%")$
  104. ;Substract one from the SizeList value
  105. ^!Dec %SizeList%
  106. ;Format list so it can be used in Clip wizard
  107. ^!Set %LibraryList%=^$StrCopy("^%LibraryList%";1;^%SizeList%)$
  108.  
  109. ;Show appropriate wizard based on the number of installed libraries
  110. ^!If ^%Count% = 1 Next ELSE ChooseLibraryPrompt
  111. ;Copy library name from list variable to LibraryName variable
  112. ^!Set %LibraryName%=^%LibraryList%
  113. ;Show Clip wizard
  114. ^!Set %OpenLibraryName%=^?{(T=C)Would you like to open the new library?==_Yes|No}; %ShowClipbook%=^?{(T=C)Show Clipbook window?==_Yes|No}
  115. ;Jumpt to OpenLibrary label if user wants to open the newly installed library, otherwise end the Clip
  116. ^!IfTrue ^%OpenLibraryName% OpenLibrary ELSE Exit
  117.  
  118. :ChooseLibraryPrompt
  119. ;Show Clip wizard
  120. ^!Set %LibraryName%=^?{(H=5)Open new library?==_^%LibraryList%}; %ShowClipbook%=^?{(T=C)Show Clipbook window?==_Yes|No}
  121.  
  122. :OpenLibrary
  123. ;Show or hide Clipbook window based on user's choice
  124. ^!ShowClipbook ^%ShowClipbook%
  125. ;Remove first space character added by the Append instruction
  126. ^!Set %LibraryName%=^$StrDelete("^%LibraryName%";1;1)$
  127. ;Open chosen library
  128. ^!LoadLibrary ^%LibraryName%
  129. ^!IfError Next ELSE Skip
  130. ^!Prompt Error: could not open "^%LibraryName%"
  131.  
  132.  
  133. H="Remove Libraries"
  134. ;Store list of library names in the variable LibraryList
  135. ^!Clip FillLibraryList
  136.  
  137. ;Show Clip wizard
  138. ^!SetArray %LibraryNames%=^?{(H=10;T=A)Choose libraries to remove=^%LibraryList%}
  139. ;Copy the value representing the number of items into the Count variable. The variable at index 0 indicates the number of items in the array
  140. ^!Set %Count%=^%LibraryNames0%
  141. ;If no files were chose, leave the loop
  142. ^!If ^%Count% = 0 Exit
  143.  
  144. ;Initialize the Index variable to 0
  145. ^!Set %Index%=0
  146.  
  147. ;Beginning of loop
  148. :StartLoop
  149. ;Add one to the value contained in the variable Index
  150. ^!Inc %Index%
  151. ;End the Clip if the Index number is greater than the Count number
  152. ^!If ^%Index% > ^%Count% EndLoop
  153. ;Copy the library file name corresponding to the current index value to a variable. The content of the array's indexed variable is used here. Remove first space character added by FillLibraryList Clip
  154. ^!Set %LibraryName%=^$StrDelete("^%LibraryNames^%Index%%";1;1)$
  155. ;Remove the library by sending it to the Windows recycle bin
  156. ^!RecycleFile "^$GetLibraryPath$^%LibraryName%.clb"
  157. ;Jump back to the start of the loop
  158. ^!Goto StartLoop
  159.  
  160. :EndLoop
  161. ^!Refresh
  162. ^!Prompt ^%Count% libraries removed
  163.  
  164.  
  165. H=";"
  166.  
  167.  
  168. H=";Text Processing"
  169. Below, you will find a brief explanation about each Clip under this topic.
  170.  
  171. 1) Paste Internet acronym:
  172. When you activate this Clip, a Clip wizard will popup with a list of sentences that correspond to common Internet acronyms. Just double click on the item that you want to use and the corresponding acronym will be pasted in your document at the cursor position.
  173.  
  174. 2) Underline title:
  175. First place the cursor on the line you would like to underline, then activate the Clip. The Clip wizard will then let you choose the type of character to use for producing the underline text.
  176.  
  177. 3) Compare two files:
  178. The Clip uses the DOS command "fc" to compare the differences between two disk files. Although you can choose any two files you want to compare, NoteTab will offer the current document name by default for the first file. If necessary, NoteTab saves a temporary copy of the current document before starting the comparison program. Note that the Clip converts long file names to DOS short names so that they can be accepted by the "fc" utility.
  179.  
  180. 4) Enable AutoCorrect mode:
  181. When you activate this Clip, it will open the AutoCorrect library and then hide the Clipbook window. Auto-replace mode will be enabled and your typing will be checked for matching items in the library. If a typo is found, it will automatically be replaced with the correct spelling.
  182.  
  183.  
  184. H="Paste Internet acronym"
  185. ^?[(H=8)Choose acronym to paste==_By the Way^=BTW|For What it's Worth^=FWIW|For Your Information^=FYI|I Am Not A Lawyer^=IANAL|In Any Event^=IAE|In My Considered Opinion^=IMCO|In My Humble Opinion^=IMHO|In My Opinion^=IMO|In Other Words^=IOW|Just One of Those Things^=JOOTT|Laughing Out Loud^=LOL|No Reply Necessary^=NRN|On the Other Hand^=OTOH|Real Soon Now [Which May be a Long Time Coming]^=RSN|Rolling on Floor Laughing^=ROFL|Rolling on the Floor Laughing^=ROTFL|Still in the Dark^=SITD|Thanks in Advance^=TIA|There Ain't No Such Thing as a Free Lunch^=TANSTAAFL|Three Letter Acronym^=TLA|Tongue in Cheek^=TIC|With Respect To^=WRT]
  186.  
  187. H="Underline title"
  188. ;Underlines with the chosen character the line at the cursor
  189. ;Ensure input focus returns to document
  190. ^!FocusDoc
  191. ;Place the cursor at the end of the line
  192. ^!Jump LINE_END
  193. ;Determine the line length
  194. ^!Set %TitleLength%=^$Calc(^$GetColScreen$-1)$
  195. ;Cancel procedure if the line is blank
  196. ^!If ^%TitleLength% < 1 Exit
  197. ;Insert line break followed by sequence of underline characters
  198. ^!SetPasteIndent Off
  199. ^!InsertText ^P^$StrFill(^?{Underline character=_»|=|-|~|^|¿|╖};^%TitleLength%)$
  200.  
  201. H="Compare two files"
  202. ;The Clip uses the DOS command "fc" to compare the differences between two disk files. If necessary, NoteTab saves a temporary copy of the current document before starting the comparison program
  203. ;Define the delimiter for the checkbox field
  204. ^!SetListDelimiter " "
  205. ;Prompt for file names and option settings used to control the comparisor
  206. ^!Set %File1%="^?{(T=O)Compare file=^**}"; %File2%="^?{(T=O)With file=^$GetPath("^**")$}"; %Options%=^?{(H=5;T=A)Switches=_Compares files as ASCII text^=/L|Ignore character case^=/C|Display only first+last lines^=/A|_Do not expand tabs to spaces^=/T|Display line numbers on an ASCII comparison^=/N}
  207. ;End the procedure if no file is specified
  208. ^!IfTrue ^$IsEmpty("^%File1%")$ End
  209.  
  210. ;Set output file name in a variable
  211. ^!Set %OutputFile%=^$GetName("^%File1%")$.dif
  212. ;Convert long file names to DOS short names
  213. ^!Set %File1%=^$GetShort("^%File1%")$
  214. ^!Set %File2%=^$GetShort("^%File2%")$
  215. ;Copy the file path in a variable
  216. ^!Set %Path%=^$GetPath("^%File1%")$
  217.  
  218. ;If both files being compared are in the same directory, remove the path part from the second file name
  219. ^!IfSame "^%Path%" "^$GetPath("^%File2%")$" Next ELSE Skip
  220. ^!Set %File2%=^$GetFileName("^%File2%")$
  221.  
  222. ;Create and save the command line in a variable
  223. ^!Set %Command%=fc ^%Options% ^$GetFileName("^%File1%")$ ^%File2% >^%OutputFile%
  224. ;Show warning if command line exceeds the normal DOS length limit
  225. ^!If ^$StrSize("^%Command%")$ > 127 Warning ELSE Execute
  226.  
  227. :Warning
  228. ^!Info Warning: the DOS command line about to be executed is very long; it might not work. In case of failure, try to shorten the path/file names of the documents you want to compare.
  229.  
  230. :Execute
  231. ;Delete the output file if it already exists (created by earlier comparison)
  232. ^!DeleteFile ^%OutputFile%
  233. ;Set the default path
  234. ^!ChDir ^%Path%
  235. ;Execute the fc command with all parameters
  236. ^!CmdShow Minimize
  237. ^!DOS ^%Command%
  238. ;Wait until the command has finished executing
  239. ^!Wait
  240. ;Copy output name to variable
  241. ^!Set %OutputFile%=^%Path%^%OutputFile%
  242. ;Open the output file if it exists or show error message
  243. ^!IfFileExist ^%OutputFile% Next ELSE Error
  244. ^!Open ^%OutputFile%
  245. ^!Goto End
  246.  
  247. :Error
  248. ^!Info File comparison failed
  249.  
  250. H="Enable AutoCorrect mode"
  251. ;Opens the AutoCorrect library in the Editor Clipbook
  252. ^!LoadLibrary AutoCorrect.clb
  253. ;Hides the Clipbook window
  254. ^!ShowClipbook False
  255.  
  256. H=";"
  257.  
  258.  
  259. H=";Without Clipboard"
  260. The Clips in this section provide typical Clipboard functions without actually using it. The cut and copy procedures actually copy the text selection to a temporary variable in the Clipbook.
  261.  
  262. 1) Copy/paste:
  263. Performs copy and paste operations without using the Windows Clipboard. If text is selected, NoteTab assumes you want to perform a Copy operation. If no text is selected but a Copy or Cut operation has been performed beforehand, Notetab will paste the copied text into the document.
  264.  
  265. 2) Cut/paste:
  266. Performs cut and paste operations without using the Windows Clipboard. If text is selected, NoteTab assumes you want to perform a Cut operation. If no text is selected but a Copy or Cut operation has been performed beforehand, Notetab will paste the copied text into the document.
  267.  
  268. 3) Duplicate line:
  269. Duplicates the line at the cursor.
  270.  
  271.  
  272. H="Copy/paste"
  273. ;Performs copy and paste operations without using the Windows Clipboard
  274. ;If text is selected, NoteTab assumes you want to perform a Copy operation. If no text is selected but a Copy or Cut operation has been performed beforehand, Notetab will paste the copied text into the document
  275. ^!FocusDoc
  276. ^!If ^$GetSelSize$ = 0 Next ELSE CopyText
  277. ^!IfTrue ^$IsEmpty("^%KeepText%")$ End
  278. ^!SetPasteIndent Off
  279. ^!InsertCode ^%KeepText%
  280. ^!GoTo End
  281. :CopyText
  282. ^!SetCode %KeepText%=^$GetSelection$
  283. ^!Jump Select_End
  284.  
  285. H="Cut/paste"
  286. ;Performs cut and paste operations without using the Windows Clipboard
  287. ;If text is selected, NoteTab assumes you want to perform a Cut operation. If no text is selected but a Copy or Cut operation has been performed beforehand, Notetab will paste the copied text into the document
  288. ^!FocusDoc
  289. ^!If ^$GetSelSize$ = 0 Next ELSE CutText
  290. ^!IfTrue ^$IsEmpty("^%KeepText%")$ End
  291. ^!SetPasteIndent Off
  292. ^!InsertCode ^%KeepText%
  293. ^!GoTo End
  294. :CutText
  295. ^!SetCode %KeepText%=^$GetSelection$
  296. ^!InsertText ^%EMPTY%
  297.  
  298. H="Duplicate line"
  299. ;Duplicates the line at the cursor
  300. ^!FocusDoc
  301. ;Start by selecting the current line (or word-wrapped line)
  302. ^!Select Paragraph
  303. ;End the procedure if the line is empty
  304. ^!If ^$GetSelSize$ = 0 End
  305. ;Copy the selection into a variable
  306. ^!Set %ParaText%=^$GetSelection$
  307. ;Place cursor at end of selection and remove highlight
  308. ^!Jump Select_End
  309. ;Check if the paragraph ends with a line break; if not, add one to the front of our copy in the variable
  310. ^!If ^$StrCopyRight("^%ParaText%";2)$ = ^%NL% Skip
  311. ^!SetCode %ParaText%=^%NL%^%ParaText%
  312. ;Insert copied line back into document
  313. ^!InsertCode ^%ParaText%
  314.  
  315. H=";"
  316.  
  317.  
  318. H=";Print"
  319. The Clips in this section provide useful printing shortcuts. If text is highlighted, then only the selection is printed, otherwise the whole document or current Outline item is printed.
  320.  
  321. 1) Print dialog:
  322. Displays the Print dialog box so that you can select a printer and modify certain options before starting the print job.
  323.  
  324. 2) Print preview:
  325. Sends text to the Print Preview window. You can then decide whether to start the print job or cancel the procedure.
  326.  
  327. 3) Print direct:
  328. Sends text directly to printer using current default settings. The Print dialog box is not displayed.
  329.  
  330.  
  331. H="Print dialog"
  332. ;Displays the Print dialog box so that you can select a printer and modify certain options before starting the print job.
  333. ^!PrintDialog ^$GetSelection$
  334.  
  335. H="Print preview"
  336. ;Sends text to the Print Preview window. You can then decide whether to start the print job or cancel the procedure.
  337. ^!IfTrue ^$IsLightVersion$ NotAvailable
  338. ^!PrintPreview ^$GetSelection$
  339. ^!Goto End
  340.  
  341. :NotAvailable
  342. ^!Prompt Sorry, this feature is not available in NoteTab Light
  343.  
  344. H="Print direct"
  345. ;Sends text directly to printer using current default settings. The Print dialog box is not displayed.
  346. ^!PrintText ^$GetSelection$
  347.  
  348. H=";"
  349.  
  350.  
  351. H=";Internet"
  352. This section offers several useful commands to tidy or generate web pages, or convert HTML documents to plain text.
  353.  
  354. 1) Images to HTML:
  355. This Clip will create a web page based on all the images that match a specified criteria. You can then easily preview all the images in your favorite browser. Before the web page is created, a Clip wizard is displayed so you can choose which directory it should search, what type of images it should include in the page, and the sorting order. The resulting web page displays all the matching images, together with their file name, the picture's dimensions in pixels (width and height), and the file size. You can then put this page together with your pictures on a web server.
  356.  
  357. 2) Tidy HTML code:
  358. This Clip will change the format of your HTML tags and clean up the code in all open HTML documents. The internal NoteTab commands let you choose between upper/lower case tags, or the new XHTML format. If you have installed the HTML Tidy program, you can also change the indenting and column wrap. Furthermore, HTML Tidy can correct minor errors in your code.
  359.  
  360. 3) Convert HTML to text:
  361. This Clip will convert all the HTML documents open in NoteTab into plain text files. A Clip wizard gives you the choice to keep the links in tags or not, and to automatically save the resulting text files or not.
  362.  
  363. 4) Convert Text to HTML:
  364. This Clip will convert all the non-HTML documents open in NoteTab into web pages. A Clip wizard gives you the choice to automatically save the resulting HTML files or not.
  365.  
  366. 5) Convert "Mailto" form:
  367. This Clip will convert output generated by "Mailto" forms into plain text. If text is initially selected in the document, the conversion will only be applied to that part, otherwise the whole document is processed.
  368.  
  369. 6) Outline document to HTML:
  370. Converts the current outline document into a web page with table of contents and links. If the current document is not an outline, the Clip will offer to demonstrate the feature on the Readme.otl document, which is part of the NoteTab package.
  371.  
  372. 7) Outline topics to HTML:
  373. This Clip will convert each outline topic into an individual web page. You can choose whether to keep the created HTML files open in NoteTab or have them closed automatically. If the current document is not an outline, the Clip will offer to demonstrate the feature on the Readme.otl document, which is part of the NoteTab package.
  374.  
  375. 8) Select between tags:
  376. This Clip will select all the text between the type of tag specified by the user. The search starts from the cursor position or the beginning of the text, depending on the users choice.
  377.  
  378. 9) Insert HRef Link:
  379. Opens the Clip wizard so you can choose which web page and description you want to use in the link. The Clip then inserts the HRef tag into your document at the cursor position.
  380.  
  381. 10) Insert Img Link:
  382. Opens the Clip wizard so you can choose which image and ALT description you want to use in the link. The Clip then inserts the Img tag, complete with the image size attributes into your document at the cursor position.
  383.  
  384.  
  385. H="Images to HTML"
  386. ;This Clip will create a web page based on all the images that match the specified criteria. You can then easily preview all the images in your favorite browser
  387.  
  388. ;Prompt user with Clip wizard to determine which image files should be listed and how the page should be built
  389. ^!Set %PageTitle%=^?{Page title=Images}; %FileName%=^?{Web page file name (no path or extension)=Images}; %Directory%=^?{(T=D)Directory to search}; %Specs%=^?{File Specs=*.gif;*.png;*.jpg}; %Sorting%=^?{(T=C)File sorting==Unsorted|_Name|Type|Date|Size}; %Reverse%=^?{(T=C)Descending order==Yes^=Rev|_No^=}
  390. ;End procedure if the user canceled the Clip wizard
  391. ^!IfCancel Exit
  392.  
  393. ^!SetPasteIndent Off
  394. ;Set variable for sorting parameter
  395. ^!Set %Sorting%=^%Reverse%^%Sorting%
  396. ;Close the output file if there is one open in NoteTab
  397. ^!Close "^%Directory%^%FileName%.htm"
  398. ;Create a new document with specified name for web page
  399. ^!Set %KeepNameFormat%=^$GetNameFormat$
  400. ^!SetNameFormat ^%Directory%^%FileName%.htm
  401. ^!ToolBar New Document
  402. ^!SetNameFormat ^%KeepNameFormat%
  403. ;Turn word wrap off
  404. ^!SetWordWrap OFF
  405. ;Insert web page header and title
  406. ^!InsertHtml <HTML>^P<HEAD>^P<TITLE>^%PageTitle%</TITLE>^P<META name="generator" content="^$GetProgName$ ^$GetProgVersion$">^P</HEAD>^P<BODY>^P<CENTER>^P<H1>^%PageTitle%</H1>^P<H2>^%Directory%^%Specs%</H2>^P<HR>^P</CENTER>^P
  407.  
  408. ;Retrieve first image name that matches specified search criteria
  409. ^!Set %ImageFullName%=^$GetFileFirst(^%Directory%;"^%Specs%";^%Sorting%)$
  410. :StartLoop
  411. ;If the image name is empty (no more matching files), leave the loop
  412. ^!IfTrue ^$IsEmpty(^%ImageFullName%)$ ExitLoop
  413. ;Copy image name without path to variable
  414. ^!Set %ImageName%=^$GetFileName(^%ImageFullName%)$
  415. ;Copy image width and height information into variables
  416. ^!Set %ImgWidth%=^$GetImgWidth(^%ImageFullName%)$; %ImgHeight%=^$GetImgHeight(^%ImageFullName%)$
  417. ;Insert image tag and information into document
  418. ^!InsertHtml <IMG SRC="^$StrLower("^%ImageName%")$" WIDTH="^%ImgWidth%" HEIGHT="^%ImgHeight%" BORDER="0" ALT="^%ImageName%"><BR>^%ImageName% (^%ImgWidth%x^%ImgHeight%; ^$GetFileSize(^%ImageFullName%)$ bytes)<P>^P
  419.  
  420. ;Get next matching image name and go back to start of loop
  421. ^!Set %ImageFullName%=^$GetFileNext$
  422. ^!GoTo StartLoop
  423.  
  424. :ExitLoop
  425. ;Close the file-find variable to restore system resources
  426. ^!CloseFileFind
  427. ;Insert line break after last image tag
  428. ^!InsertText ^P
  429. ;Insert web page closing tags
  430. ^!InsertHtml <HR>^P<CENTER>^P<I>This HTML document was produced with a popular Text and HTML editor called <B><A HREF="http://www.notetab.com/">^$GetProgName$</A></B></I>^P</CENTER>^P<HR>^P<SMALL>Page created on <B>^$GetDate(mmmm dd, yyyy)$</B></SMALL>^P</BODY>^P</HTML>^P
  431.  
  432. ;Place cursor back to top of page
  433. ^!Jump Text_Start
  434. ;Offer user the choice to display the newly created web page in browser or end Clip
  435. ^!Goto ^?{What would you like to do now?==_View page in main browser^=Next|View page in second browser^=SecondBrowser|No preview^=End}
  436. ^!ToolBar View in Browser
  437. ^!Goto End
  438. :SecondBrowser
  439. ^!ToolBar View Other Browser
  440.  
  441. H="Tidy HTML code"
  442. ;Tidy code in all open HTML documents. This Clip can use the HTML Tidy program, if available
  443. ^!Continue This Clip will tidy the code in all open HTML documents. Continue?
  444.  
  445. ;Copy the document count in a variable
  446. ^!Set %Index%=^$GetDocCount$
  447.  
  448. ;Determine method to use
  449. ^!Set %UseHtmlTidy%=No
  450. ^!IfFileExist "^$GetTidyExe$" ^!Set %UseHtmlTidy%=Yes
  451. ^!IfFalse ^%UseHtmlTidy% InitPlain
  452. ;If HTML Tidy is found, ask which method the user would like to use
  453. ^!Set %UseHtmlTidy%=^?{Select method==_Use HTML Tidy program (more options)^=Yes|Use NoteTab commands (much faster)^=No}
  454. ^!IfTrue ^%UseHtmlTidy% InitTidy
  455.  
  456. :InitPlain
  457. ^!Set %Param%=^?{Tag format?==_Uppercase|Lowercase|XHTML}; %SaveChanges%=^?{Automatically save changed documents?==Yes|_No}; %Label%=CallPlain
  458. ^!Goto LoopStart
  459.  
  460. :InitTidy
  461. ^!Set %Param%=--tidy-mark false -q^?{Indent HTML code?==_Yes^=i|No^=}^?{Tag format?==_Uppercase^=u|Lowercase^=|XHTML^= -asxml}^?{Wrap long lines?==Yes^=|_No^= -wrap 0}; %SaveChanges%=^?{Automatically save changed documents?==Yes|_No}; %Label%=CallTidy
  462.  
  463. ;Check every open document through the following loop
  464. :LoopStart
  465. ;Activate the specified document (starts with the last one in the tab bar)
  466. ^!SetDocIndex ^%Index%
  467. ;Skip the conversion process if the document does not have an HTML extension or is a Clipbook library
  468. ^!IfFalse ^$IsHTMLDoc$ UpdateIndex
  469. ^!IfTrue ^$IsClipDoc$ UpdateIndex
  470. ^!Goto ^%Label%
  471.  
  472. ;Tidy the contents of the current document
  473. :CallPlain
  474. ^!Select ALL
  475. ^!InsertText ^$GetHtmlTextTidy("^$GetSelection$";^%Param%)$
  476. ^!Goto EndCall
  477.  
  478. :CallTidy
  479. ^!RunTidy ^%Param%
  480. ^!IfError UpdateIndex
  481.  
  482. :EndCall
  483. ;Place the cursor at the start of the document
  484. ^!Jump Text_Start
  485. ;Save converted document if users wants this done automatically
  486. ^!IfFalse ^%SaveChanges% UpdateIndex
  487. ^!IfFalse ^$IsModified$ UpdateIndex
  488. ^!Save
  489.  
  490. :UpdateIndex
  491. ;Substract one from the Index value
  492. ^!Dec %Index%
  493. ;Go back to start of loop if there are still documents left to check
  494. ^!If ^%Index% > 0 LoopStart
  495.  
  496. H="Convert HTML to text"
  497. ;Converts all open HTML documents into plain text files
  498. ^!Continue This Clip will convert all open HTML documents to plain text files. Continue?
  499. ;Copy the document count in a variable
  500. ^!Set %Index%=^$GetDocCount$
  501.  
  502. ;Check every open document through the following loop
  503. :LoopStart
  504. ;Activate the specified document (starts with the last one in the tab bar)
  505. ^!SetDocIndex ^%Index%
  506. ;Skip the conversion process if the document does not have an HTML extension or is a Clipbook library
  507. ^!IfFalse ^$IsHTMLDoc$ SkipConversion
  508. ^!IfTrue ^$IsClipDoc$ SkipConversion
  509. ;Strip tags from current document
  510. ^!Toolbar Strip ^?[Keep links in tags?==_Yes^=Tags|No^=HTML]
  511. ^!IfError SkipConversion
  512. ;Place the cursor at the start of the document
  513. ^!Jump Text_Start
  514. ;Save converted document if users wants this done automatically
  515. ^!IfFalse ^?[Automatically save converted documents?==_Yes|No] Skip
  516. ^!Save As ^##
  517.  
  518. :SkipConversion
  519. ;Substract one from the Index value
  520. ^!Dec %Index%
  521. ;Go back to start of loop if there are still documents left to check
  522. ^!If ^%Index% > 0 LoopStart
  523.  
  524. H="Convert Text to HTML"
  525. ;Converts all open non-HTML documents to HTML
  526. ^!Continue This Clip will convert all open non-HTML documents to HTML documents. Continue?
  527. ;Copy the document count in a variable
  528. ^!Set %Index%=^$GetDocCount$
  529.  
  530. ;Check every open document through the following loop
  531. :LoopStart
  532. ;Activate the specified document (starts with the last one in the tab bar)
  533. ^!SetDocIndex ^%Index%
  534. ;Skip the conversion process if the document has an HTML extension or is a Clipbook library
  535. ^!IfTrue ^$IsHtmlDoc$ SkipConversion
  536. ^!IfTrue ^$IsClipDoc$ SkipConversion
  537. ;Convert text to HTML format
  538. ^!Toolbar Document to HTML
  539. ^!IfError SkipConversion
  540. ;Place the cursor at the start of the document
  541. ^!Jump Text_Start
  542. ;Save converted document if users wants this done automatically
  543. ^!IfFalse ^?[Automatically save converted documents?==_Yes|No] Skip
  544. ^!Save As ^##
  545.  
  546. :SkipConversion
  547. ;Substract one from the Index value
  548. ^!Dec %Index%
  549. ;Go back to start of loop if there are still documents left to check
  550. ^!If ^%Index% > 0 LoopStart
  551.  
  552. H="Convert "Mailto" form"
  553. ;Converts output text created by "Mailto" forms. If text is selected in the document, the conversion will only be applied to that part, otherwise the whole document is processed
  554. ^!If ^$GetSelSize$ > 2 Skip
  555. ^!ToolBar Select All
  556. ^!If ^$GetSelSize$ = 0 End
  557. ^!SetPasteIndent Off
  558. ^!InsertText ^$StrUrlDecode("^$GetSelection$")$
  559.  
  560. H="Outline document to HTML"
  561. ;Converts the current outline document into a web page
  562.  
  563. ;If the current document is an outline, start the procedure. Otherwise ask whether to demonstrate the feature on the Readme.otl document, which is part of the NoteTab package
  564. ^!IfTrue ^$IsOutlineDoc$ Start ELSE Next
  565. ;Check if the Readme.otl document exists. If not, skip demonstration procedure and show error message
  566. ^!IfFileExist ^$GetAppPath$Readme.Otl Next ELSE ShowErrorMsg
  567. ^!Continue The current document is not an outline. Would you like to see a demonstration with the Readme.Otl file?
  568. ;Open the Readme.otl document
  569. ^!Open ^$GetAppPath$Readme.Otl
  570. ;If there was an error while trying to open it, show message and end procedure
  571. ^!IfError Next ELSE Start
  572. ^!Prompt Error: could not open "^$GetAppPath$Readme.Otl"
  573.  
  574. :Start
  575. ;Convert the outline file to HTML format
  576. ^!Toolbar Document to HTML
  577. ;Place the cursor at the start of the document
  578. ^!Jump Text_Start
  579. ;Offer user the choice to display the newly created web page in browser or end Clip
  580. ^!Goto ^?{What would you like to do now?==_View page in main browser^=Next|View page in second browser^=SecondBrowser|No preview^=End}
  581. ^!ToolBar View in Browser
  582. ^!Goto End
  583.  
  584. :SecondBrowser
  585. ^!ToolBar View Other Browser
  586. ^!Goto End
  587.  
  588. :ShowErrorMsg
  589. ^!Prompt Error: the current document is not an outline
  590.  
  591. H="Outline topics to HTML"
  592. ;This Clip will convert each outline topic into an individual web page. The user can choose whether to keep the created files open in NoteTab or have them closed automatically
  593.  
  594. ;If the current document is an outline, start the procedure. Otherwise ask whether to demonstrate the feature on the Readme.otl document, which is part of the NoteTab package
  595. ^!IfTrue ^$IsOutlineDoc$ Start ELSE Next
  596. ;Check if the Readme.otl document exists. If not, skip demonstration procedure and show error message
  597. ^!IfFileExist ^$GetAppPath$Readme.Otl Next ELSE ShowErrorMsg
  598. ^!Continue The current document is not an outline. Would you like to see a demonstration with the Readme.Otl file?
  599. ;Open the Readme.otl document
  600. ^!Open ^$GetAppPath$Readme.Otl
  601. ;If there was an error while trying to open it, show message and end procedure
  602. ^!IfError Next ELSE Start
  603. ^!Prompt Error: could not open "^$GetAppPath$Readme.Otl"
  604.  
  605. :Start
  606. ;Copy the name of the outline document to a variable
  607. ^!Set %OutlineName%=^$GetName("^##")$
  608. ;Copy user's choice for keeping the web pages open or not
  609. ^!Set %KeepOpen%=^?[Keep new HTML documents open in editor?==_Yes|No]
  610. ;Store the current document index in a variable
  611. ^!Set %DocIndex%=^$GetDocIndex$
  612. ;Set the TopicIndex variable to 0
  613. ^!Set %TopicIndex%=0
  614. ;Store the topic count in a variable
  615. ^!Set %TopicCount%=^$GetTopicCount$
  616. ;Change the name format for newly created documents to the outline file name with the .html extension
  617. ^!Set %KeepNameFormat%=^$GetNameFormat$
  618. ^!SetNameFormat ^$GetDataPath$^%OutlineName%%0.2d.html
  619.  
  620. :LoopStart
  621. ;Add one to the value contained in the TopicIndex variable
  622. ^!Inc %TopicIndex%
  623. ;End the Clip if the TopicIndex number is greater than the number of topics in the outline document
  624. ^!If ^%TopicIndex% > ^%TopicCount% EndClip
  625. ;Activate the outline document if it is not already the current one
  626. ^!SetDocIndex ^%DocIndex%
  627. ;Move to the topic defined in the TopicIndex variable
  628. ^!SetTopicIndex ^%TopicIndex%
  629. ;Copy the content of the topic to the Clipboard
  630. ^!SetClipboard ^$GetText$
  631. ;Paste the content of the Clipboard into a new document
  632. ^!ToolBar Paste New
  633. ;Convert the text in the new document to the HTML format
  634. ^!Toolbar Document to HTML
  635. ;Place the cursor at the start of the text in the new HTML document
  636. ^!Jump Text_Start
  637. ;Save the new HTML document without prompting the user for the name
  638. ^!Save AS ^##
  639. ;Close the HTML document if the user chose to do so
  640. ^!IfTrue ^%KeepOpen% Skip
  641. ^!Close
  642. ;Go back to the start of the loop
  643. ^!GoTo LoopStart
  644.  
  645. :ShowErrorMsg
  646. ^!Prompt Error: the current document is not an outline
  647. ^!GoTo End
  648.  
  649. :EndClip
  650. ;Restore the original new document name format
  651. ^!SetNameFormat ^%KeepNameFormat%
  652.  
  653. H="Select between tags"
  654. ;This Clip will select all the text between the type of tag specified by the user. The search starts from the cursor position or the beginning of the text
  655.  
  656. ^!Set %Range%=^?[(2)Search from...==Start of text^=W|Cursor position forwards^=|_Cursor position backwards^=B]
  657. ;If search direction is different from backwards, jump to the instruction following the SearchForwards label
  658. ^!If ^%Range% <> B SearchForwards
  659. ;Clear the content of the Range variable
  660. ^!ClearVariable %Range%
  661. ;Search backwards for the first matching tag
  662. ^!Find "<^?[(1)Tag=a|address|applet|b|big|blockquote|body|caption|center|em|form|frameset|font|head|i|iframe|li|kbd|noframes|noscript|ol|option|p|pre|script|small|strike|strong|style|table|td|th|title|tr|ul|var]" ISB
  663. ;End procedure if the searched tag is not found
  664. ^!IfError End
  665. ;Place cursor at end of selection and remove highlight
  666. ^!Jump Select_End
  667. ;Find end of opening tag
  668. ^!Find ">" IS
  669. ^!IfError End
  670. ^!Goto SetStartPosition
  671.  
  672. :SearchForwards
  673. ;Search forwards for the opening tag
  674. ^!Find "<^?[Tag]" CIS^%Range%
  675. ;End procedure if the searched tag is not found
  676. ^!IfError End
  677. ;Place cursor at end of selection and remove highlight
  678. ^!Jump Select_End
  679. ;Find end of opening tag
  680. ^!Find ">" S
  681. ^!IfError End
  682.  
  683. :SetStartPosition
  684. ;Ensure input focus is in the document
  685. ^!FocusDoc
  686. ;Place cursor at end of selection and remove highlight
  687. ^!Jump Select_End
  688. ;Store cursor position in a variable
  689. ^!Set %Start%=^$GetRow$:^$GetCol$
  690. ;Search for the closing tag
  691. ^!Find "</^?[Tag]>" IS
  692. ;End the procedure if it is not found
  693. ^!IfError End
  694.  
  695. ;Place cursor at start of selection and remove highlight
  696. ^!Jump Select_Start
  697. ;Store cursor position in a variable
  698. ^!Set %End%=^$GetRow$:^$GetCol$
  699. ;Move the cursor back to the first saved position (after the opening tag)
  700. ^!SetCursor ^%Start%
  701. ;Extend the selection to the second saved position (in front of the closing tag)
  702. ^!SelectTo ^%End%
  703.  
  704. H="Find next link text"
  705. ;works for a search in an HTML document
  706. ^!Find "<a.*?>(.*?)</a>" IR1
  707.  
  708.  
  709. H="Find next email address"
  710. ^!Find "([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([A-Z]{2,4}|[0-9]{1,3})(\]?)" IR
  711.  
  712. H="Collect URLs from tags"
  713. ;works for a search in an HTML document
  714. ^!SetListDelimiter ^P
  715. ^!Set %List%=^$GetDocMatchAll("(?s)<a.+?href\s*?=\s*?"(.*?)"";1)$
  716. ^!ToolBar New Document
  717. ^!InsertText ^%List%
  718. ^!ToolBar Sort Ascending
  719. ^!Jump DOC_START
  720.  
  721.  
  722. H="Collect image links from tags"
  723. ;works for a search in an HTML document
  724. ^!SetListDelimiter ^P
  725. ^!Set %List%=^$GetDocMatchAll("(?s)<img.+?src\s*?=\s*?"(.*?)"";1)$
  726. ^!ToolBar New Document
  727. ^!InsertText ^%List%
  728. ^!ToolBar Sort Ascending
  729. ^!Jump DOC_START
  730.  
  731.  
  732. H=";"
  733.  
  734.  
  735. H=";Conversions"
  736. This section offers a series of Clips that let you easily convert between the most common units. A Clip wizard will prompt you for the value to convert and will then display the result in another window.
  737.  
  738.  
  739.  
  740. H="Fahrenheit -> Celsius"
  741. ^!Prompt ^?[Temperature in Fahrenheit]░F = ^$Calc(((^?[Temperature in Fahrenheit])-32)*(5/9))$░C
  742.  
  743. H="Celsius -> Fahrenheit"
  744. ^!Prompt ^?[Temperature in Celsius]░C = ^$Calc((^?[Temperature in Celsius])*(9/5)+32)$░F
  745.  
  746. H=";----"
  747.  
  748.  
  749. H="Inches -> Centimeters"
  750. ^!Prompt ^?[Length in inches] inches = ^$Calc(^?[Length in inches]*2.5400)$ cm
  751.  
  752. H="Centimeters -> Inches"
  753. ^!Prompt ^?[Length in centimeters] cm = ^$Calc(^?[Length in centimeters]/2.5400)$ inches
  754.  
  755. H="Feet -> Meters"
  756. ^!Prompt ^?[Length in feet] feet = ^$Calc(^?[Length in feet]*0.3048)$ meters
  757.  
  758. H="Meters -> Feet"
  759. ^!Prompt ^?[Length in meters] meters = ^$Calc(^?[Length in meters]*3.2808)$ feet
  760.  
  761. H="Miles -> Kilometers"
  762. ^!Prompt ^?[Distance in miles] miles = ^$Calc(^?[Distance in miles]/0.6214)$ kilometers
  763.  
  764. H="Kilometers -> Miles"
  765. ^!Prompt ^?[Distance in kilometers] kilometers = ^$Calc(^?[Distance in kilometers]*0.6214)$ miles
  766.  
  767. H=";----"
  768.  
  769.  
  770. H="Ounces -> Grams"
  771. ^!Prompt ^?[Weight in ounces] ounces = ^$Calc(^?[Weight in ounces]*28.3495)$ grams
  772.  
  773. H="Grams -> Ounces"
  774. ^!Prompt ^?[Weight in grams] grams = ^$Calc(^?[Weight in grams]*0.0353)$ ounces
  775.  
  776. H="Pounds -> Kilograms"
  777. ^!Prompt ^?[Weight in pounds] pounds = ^$Calc(^?[Weight in pounds]*0.4536)$ kg
  778.  
  779. H="Kilograms -> Pounds"
  780. ^!Prompt ^?[Weight in kilograms] kg = ^$Calc(^?[Weight in kilograms]/0.4536)$ pounds
  781.  
  782. H=";"
  783.  
  784.  
  785. H=";Mathematics"
  786. This section offers a series of Clips that demonstrate how NoteTab can calculate mathematical formulae. A Clip wizard will prompt you for the necessary values and will then display the result in another window.
  787.  
  788.  
  789.  
  790. H="Your ideal weight?"
  791. ;Lorentz Formula (thanks Christophe!)
  792. ^!Prompt Ideal weight = ^$Calc((^?[Height (cm)]-100)-((^?[Height (cm)]-150)/^?[Sex=_Male^=4|Female^=2]))$ Kg
  793.  
  794. H="Mortgage rate"
  795. ;Clip developed by Edward S. Wozniak
  796. ^!Prompt Mortgage rate = ^$Calc(^?[Mortgage amount]*(^?[Interest rate (%)]/1200)*(1+^?[Interest rate (%)]/1200)^(^?[Length of the loan (in years)]*12)/((1+^?[Interest rate (%)]/1200)^(^?[Length of the loan (in years)]*12)-1))$ per month
  797.  
  798. H="Future value of deposit"
  799. ;Clip developed by Edward S. Wozniak
  800. ^!Prompt Final Balance = ^$Calc(^?[Fixed Monthly Deposit]*((1+^?[Interest Rate (%)]/1200)^(^?[Total Deposit Periods (in years)]*12)-1)/(^?[interest Rate (%)]/1200))$
  801.  
  802. H=";"
  803.  
  804.  
  805. H=";Windows Utilities"
  806. This section offers Clips that launch some of the commonly used Windows utilities. Just double click on the Clip to start the utility.
  807.  
  808.  
  809.  
  810. H="Calculator"
  811. ^!FocusApp Calculator
  812. ^!IfError Next Else End
  813. ^!Shell calc.exe
  814.  
  815. H="Character Map"
  816. ^!Shell charmap.exe
  817.  
  818. H="Explorer"
  819. ^!FocusApp Exploring*
  820. ^!IfError Next Else End
  821. ^!Shell explorer.exe
  822.  
  823. H=";"
  824.  
  825.  
  826. H=";UNICODE files"
  827. This section offers Clips that let you easily read and write text in UNICODE format.
  828.  
  829.  
  830.  
  831. H="Import UNICODE text"
  832. ;Prompts user to choose an UNICODE file and reads text into NoteTab
  833. ^!ToolBar New Document
  834. ^!InsertText ^$GetUnicodeFileText("^?[(T=O;F="UNICODE files (*.txt)|*.txt")Open UNICODE file]")$
  835.  
  836. H="Save as UNICODE file"
  837. ;Saves current document in UNICODE format
  838. ^!Continue This command will save the text in your current document to a new file in UNICODE format. Continue?
  839. ^!TextToUnicodeFile "^?{(T=S;F="UNICODE files (*.txt)|*.txt")Save As UNICODE file}" ^$GetText$
  840.  
  841. H=";"
  842.  
  843.  
  844. H=";EBCDIC files"
  845. This section offers a series of Clips that let you easily open, save, and export EBCDIC files.
  846.  
  847.  
  848.  
  849. H="Load EBCDIC conversion table"
  850. ;Loads an EBCDIC character conversion table into NoteTab
  851. ^!LoadEbcdicCharTable ^?[(T=O;F="Character Tables (*.ebc)|*.ebc")Load EBCDIC character table=Default.ebc]
  852. ^!IfError Next ELSE Skip
  853. ^!Info Error loading EBCDIC translation table
  854.  
  855. H="Open EBCDIC document"
  856. ;Prompts user to choose an EBCDIC file(s) and opens in NoteTab
  857. ^!OpenEbcdic ^?{(T=O;S=M;F="EBCDIC files (*.cbl;*.cob;*.cpy;*.ddl;*.bms)|*.cbl;*.cob;*.cpy;*.ddl;*.bms")Open EBCDIC file(s)} /W=^?{LRECL=_Variable Width^=0|80|132|133}
  858.  
  859. H="Save document as EBCDIC"
  860. ;Saves current document in EBCDIC format
  861. ^!Continue This command will save your current document as an EBCDIC file. Are you sure you want to do this?
  862. ^!SaveEbcdic /W=^?{Line width (LRECL)=_Variable Width^=0|80|132|133}
  863.  
  864. H="Export as EBCDIC"
  865. ;Saves current document or text selection as a new file in EBCDIC format
  866. ^!Export "^?[(T=S;F="EBCDIC files (*.cbl;*.cob;*.cpy;*.ddl;*.bms)|*.cbl;*.cob;*.cpy;*.ddl;*.bms")Name for new EBCDIC file]" EBCDIC ^?[Text=SELECTION|_ALL] LRECL=^?[Line width (LRECL)=_Variable Width^=0|80|132|133]
  867.  
  868. H=";"
  869.  
  870.  
  871. H=";UUEncode/UUDecode"
  872. This section offers Clips that let you process UUEncoded data.
  873.  
  874.  
  875.  
  876. H="UUEncode file"
  877. ;Converts the chosen file to UUEncoded format and saves the result to a new file with the extension .uue
  878. ^!UUEncode "^?[(T=O)File to UUEncode]"
  879. ^!IfError ShowError
  880. ^!Prompt UUEncode successful
  881. ^!Goto End
  882.  
  883. :ShowError
  884. ^!Prompt An error has occured during the encoding process
  885.  
  886.  
  887. H="UUDecode file"
  888. ;Converts the chosen UUEncoded file to its native format and saves the result to a new file with its original name
  889. ^!UUDecode "^?[(T=O;F="UUEncoded files (*.uue)|*.uue")File to UUDecode]"
  890. ^!IfError ShowError
  891. ^!Prompt UUDecode successful
  892. ^!Goto End
  893.  
  894. :ShowError
  895. ^!Prompt An error has occured during the decoding process
  896.  
  897.  
  898. H="UUEncode text"
  899. ;Converts the text in the current document to UUEncoded format and saves it to a new document
  900. ^!SetCode %Text%=^$GetText$
  901. ^!ToolBar New Document
  902. ^!InsertCode ^$StrUUEncode("^%Text%")$
  903.  
  904. H="UUDecode text"
  905. ;Converts the UUEncoded text in the current document to its native format and saves it to a new document
  906. ^!SetCode %Text%=^$GetText$
  907. ^!ToolBar New Document
  908. ^!InsertCode ^$StrUUDecode("^%Text%")$
  909.  
  910. H=";"
  911.  
  912.  
  913. H=";Encrypt/Decrypt"
  914. This section offers Clips that let you encrypt and decrypt data.
  915.  
  916.  
  917.  
  918. H="Create password"
  919. ^!Info [L]Password:^p^$StrRandom(^?[How long should the password be?=10];^?[(T=C)What type of characters can it have?=_Alphanumerical (mixed case)^=A..Za..z0..9|Alphanumerical (uppercase)^=A..Z0..9|Alphanumerical (lowercase)^=a..z0..9|Alphabetical (mixed case)^=A..Za..z|Alphabetical (uppercase)^=A..Z|Alphabetical (lowercase)^=a..z|Hexadecimal^=A..F0..9|Numerical^=0..9])$
  920.  
  921. H="ROT13 selection"
  922. ;Performs a ROT13 operation on the current document text. If no text is selected, then the whole text is converted.
  923. ^!If ^$GetSelSize$ = 0 ^!ToolBar Select All
  924. ^!InsertCode ^$StrRot13("^$GetSelection$")$
  925.  
  926. H="Encrypt file"
  927. ;Encrypts the data in the chosen file and saves the result to a new file with the extension .npw
  928. ^!FileScramble "^?[(T=O)File to Encrypt]" "^?[(T=S;F="Encrypted files (*.npw)|*.npw")Save as (leave blank for default name)]" "^?[Encryption key (leave blank for default key)]"
  929. ^!IfError ShowError
  930. ^!Prompt Encryption successful
  931. ^!Goto End
  932.  
  933. :ShowError
  934. ^!Prompt An error has occured during the encryption process
  935.  
  936.  
  937. H="Decrypt file"
  938. ;Decrypts the data in the chosen file and saves the result to a new file with its original name
  939. ^!FileScramble "^?[(T=O;F="Encrypted files (*.npw)|*.npw")File to Decrypt]" "^?[(T=S)Save as (leave blank for default name)]" "^?[Encryption key (leave blank for default key)]"
  940. ^!IfError ShowError
  941. ^!Prompt Decryption successful
  942. ^!Goto End
  943.  
  944. :ShowError
  945. ^!Prompt An error has occured during the decryption process
  946.  
  947.  
  948. H="Encrypt selection"
  949. ;Encrypts the selected text in the current document and pastes the result over the selection
  950. ^!If ^$GetSelSize$ = 0 NoText
  951. ^!Set %Key%=^?{Encryption key (leave blank for default key)}
  952. ^!Set %Text%=^$GetSelection$
  953. ^!Set %NewText%=^$StrEncrypt("^%Text%";"^%Key%")$
  954. ^!Set %CrcText%=^$GetCrcText("^%Text%")$
  955. ^!Set %CrcNewText%=^$GetCrcText("^$StrDecrypt("^%NewText%";"^%Key%")$")$
  956. ^!If ^%CrcText% <> ^%CrcNewText% Error
  957. ^!InsertCode ^%NewText%
  958. ^!Goto End
  959.  
  960. :NoText
  961. ^!Prompt Please select the text to encrypt before using this command
  962. ^!Goto End
  963.  
  964. :Error
  965. ^!Prompt An error occured during the encryption process
  966.  
  967. H="Decrypt selection"
  968. ;Decrypts the selected text in the current document and pastes the result over the selection
  969. ^!If ^$GetSelSize$ = 0 NoText
  970. ^!Set %Key%=^?{Encryption key (leave blank for default key)}
  971. ^!InsertCode ^$StrDecrypt("^$GetSelection$";"^%Key%")$
  972. ^!Goto End
  973.  
  974. :NoText
  975. ^!Prompt Please select the text to encrypt before using this command
  976.  
  977. H=";"
  978.  
  979.  
  980. H=";Message Digests"
  981. This section offers Clips that compute the message digest, or digital signature, of the provided data.
  982.  
  983.  
  984.  
  985. H="MD5 of file"
  986. ;Returns the MD5 signature of the chosen file
  987. ^!Set %FileName%=^?[(T=O)File to analyse]
  988. ^!Info MD5 signature of "^%FileName%": ^$GetMD5File("^%Filename%")$
  989.  
  990. H="MD5 of text"
  991. ;Returns the MD5 signature of the text in the current document
  992. ^!Info MD5 signature: ^$GetMD5Text("^$GetText$")$
  993.  
  994. H="CRC32 of file"
  995. ;Returns the CRC32 signature of the chosen file
  996. ^!Set %FileName%=^?[(T=O)File to analyse]
  997. ^!Info CRC32 signature of "^%FileName%": ^$StrLower("^$IntToHex(^$GetCrcFile("^%Filename%")$)$")$
  998.  
  999. H="CRC32 of text"
  1000. ;Returns the CRC32 signature of the text in the current document
  1001. ^!Info CRC32 signature: ^$StrLower("^$IntToHex(^$GetCrcText("^$GetText$")$)$")$
  1002.  
  1003.  
  1004. H=";"
  1005.  
  1006.  
  1007. H=";NoteTab Shortcuts"
  1008. This section offers Clips that add shortcuts to NoteTab from various places under Windows.
  1009.  
  1010.  
  1011.  
  1012. H="Add Open With shortcut"
  1013. ^!Set %Ext%=^?[Extension to link with NoteTab=All^=*|.txt|.otl|.clb|.htm|.html|.ini]
  1014. ^!IfEmpty "^%Ext%" end
  1015.  
  1016. ^!IfSame "^%Ext%" "*" Start
  1017. ^!IfSame "^$StrCopyLeft(^%Ext%;1)$" "." Start
  1018. ^!Set %Ext%=.^%Ext%
  1019.  
  1020. :Start
  1021. ^!Goto ^$GetWinPlatform$
  1022.  
  1023. :Win32_NT
  1024. ^!Set %ExeFileName%=^$GetFileName(^$GetAppFileName$)$
  1025.  
  1026. ^!SaveRegValue HKEY_CURRENT_USER\Software\Classes\^%Ext%\OpenWithList\^%ExeFileName%=
  1027. ^!IfError ShowError
  1028.  
  1029. ^!Set %KeyName%=HKEY_CURRENT_USER\Software\Classes\Applications\^%ExeFileName%\shell
  1030. ^!SaveRegValue ^%KeyName%\edit:FriendlyAppName=^$GetProgName$
  1031. ^!SaveRegValue ^%KeyName%\edit\command="^$GetAppFileName$" "%1"
  1032. ^!SaveRegValue ^%KeyName%\open:FriendlyAppName=^$GetProgName$
  1033. ^!SaveRegValue ^%KeyName%\open\command="^$GetAppFileName$" "%1"
  1034. ^!IfError ShowError
  1035.  
  1036. ^!Set %KeyName%=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\^%ExeFileName%
  1037. ^!IfRegValueExist "^%KeyName%" AllGood
  1038.  
  1039. ^!SaveRegValue ^%KeyName%=^$GetAppFileName$
  1040. ^!SaveRegValue ^%KeyName%:Path=^$StrDeleteRight(^$GetAppPath$;1)$
  1041.  
  1042. :AllGood
  1043. ^!Prompt ^$GetProgName$ "Open With" shortcut has been added to Windows Explorer popup menu
  1044. ^!Goto End
  1045.  
  1046. :Win32_Win
  1047. ^!SaveRegValue HKEY_LOCAL_MACHINE\Software\CLASSES\^%Ext%\shell\^$GetProgName$=Open with ^$GetProgName$
  1048. ^!IfError ShowError
  1049.  
  1050. ^!SaveRegValue HKEY_LOCAL_MACHINE\Software\CLASSES\^%Ext%\shell\^$GetProgName$\command="^$GetAppFileName$" "%1"
  1051. ^!IfError ShowError
  1052.  
  1053. ^!Prompt The "Open with ^$GetProgName$" shortcut has been added to the Windows Explorer popup menu
  1054. ^!Goto End
  1055.  
  1056. :ShowError
  1057. ^!Prompt Error creating registry key
  1058.  
  1059.  
  1060. H="Add SendTo Shortcut"
  1061. ^!MakeShortcut SendTo "^$GetAppFileName$" "" "^$GetProgName$"
  1062. ^!IfError ShowError
  1063.  
  1064. ^!Prompt ^$GetProgName$ "Send To" shortcut has been added to the Windows Explorer popup menu
  1065. ^!Goto End
  1066.  
  1067. :ShowError
  1068. ^!Prompt Error creating shortcut
  1069.  
  1070.  
  1071. H="Add IE Default HTML Editor"
  1072. ^!Set %ExeFileName%=^$GetFileName(^$GetAppFileName$)$
  1073.  
  1074. ^!SaveRegValue ^$GetUserRegRoot$\Software\Classes\.htm\OpenWithList\^%ExeFileName%=
  1075. ^!IfError ShowError
  1076. ^!SaveRegValue ^$GetUserRegRoot$\Software\Classes\Applications\^%ExeFileName%\shell\edit:FriendlyAppName=^$GetProgName$
  1077. ^!SaveRegValue ^$GetUserRegRoot$\Software\Classes\Applications\^%ExeFileName%\shell\edit\command="^$GetAppFileName$" "%1"
  1078.  
  1079. ^!Set %KeyDefaultHtmlEditor%=HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Default HTML Editor
  1080.  
  1081. ^!IfEmpty "^$GetValue("Backup:ShellDefaultHtmlEditor")$" Next ELSE Skip_2
  1082. ^!SaveValue Backup:ShellDefaultHtmlEditor=^$GetRegValue("^%KeyDefaultHtmlEditor%\shell\edit\command")$
  1083. ^!SaveValue Backup:ShellDefaultHtmlEditorName=^$GetRegValue("^%KeyDefaultHtmlEditor%:Description")$
  1084.  
  1085. ^!SaveRegValue ^%KeyDefaultHtmlEditor%\shell\edit\command="^$GetAppFileName$" "%1"
  1086. ^!IfError ShowError
  1087. ^!SaveRegValue ^%KeyDefaultHtmlEditor%\shell\edit:FriendlyAppName=^$GetProgName$
  1088. ^!IfError ShowError
  1089. ^!SaveRegValue ^%KeyDefaultHtmlEditor%:Description=^$GetProgName$
  1090. ^!IfError ShowError
  1091.  
  1092. ^!IfEmpty "^$GetValue("Backup:ShellViewSourceEditor")$" Next ELSE Skip
  1093. ^!SaveValue Backup:ShellViewSourceEditor=^$GetRegValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\View Source Editor\Editor Name")$
  1094.  
  1095. ^!SaveRegValue HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\View Source Editor\Editor Name=^$GetAppFileName$
  1096. ^!IfError ShowError
  1097.  
  1098. ^!Prompt ^$GetProgName$ "Default HTML Editor" and "View Source Editor" shortcuts for Internet Explorer have been added to the registry
  1099. ^!Goto End
  1100.  
  1101. :ShowError
  1102. ^!Prompt Error creating registry key
  1103.  
  1104.  
  1105. H="Restore IE Default HTML Editor"
  1106. ^!Set %ShellDefaultHtmlEditor%=^$GetValue("Backup:ShellDefaultHtmlEditor")$
  1107. ^!IfEmpty "^%ShellDefaultHtmlEditor%" SKIP_2
  1108. ^!SaveRegValue HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Default HTML Editor\shell\edit\command=^%ShellDefaultHtmlEditor%
  1109. ^!IfError ShowError
  1110.  
  1111. ^!Set %ShellDefaultHtmlEditorName%=^$GetValue("Backup:ShellDefaultHtmlEditorName")$
  1112. ^!IfEmpty "^%ShellDefaultHtmlEditorName%" SKIP_2
  1113. ^!SaveRegValue HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Default HTML Editor:Description=^%ShellDefaultHtmlEditorName%
  1114. ^!IfError ShowError
  1115.  
  1116. ^!Set %ShellViewSourceEditor%=^$GetValue("Backup:ShellViewSourceEditor")$
  1117. ^!IfEmpty "^%ShellViewSourceEditor%" SKIP_2
  1118. ^!SaveRegValue HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\View Source Editor\Editor Name=^%ShellViewSourceEditor%
  1119. ^!IfError ShowError
  1120.  
  1121. ^!Prompt Previous "Default HTML Editor" and "View Source Editor" shortcuts for Internet Explorer have been restored
  1122. ^!Goto End
  1123.  
  1124. :ShowError
  1125. ^!Prompt Error updating registry key
  1126.  
  1127.  
  1128. H=";"
  1129.  
  1130.  
  1131. H=";Fookes Software links"
  1132. This section offers Clips that launch your default web browser and connect to the chosen site. Just double click on the Clip to open the web page.
  1133.  
  1134.  
  1135.  
  1136. H="Fookes Software"
  1137. ^!URL http://www.fookes.com/
  1138.  
  1139. H="NoteTab Homepage"
  1140. ^!URL http://www.notetab.com/
  1141.  
  1142. H="Clipbook Repository"
  1143. ^!URL http://www.notetab.com/libraries.php
  1144.  
  1145. H=";"
  1146.  
  1147.  
  1148. H=";________________"
  1149.  
  1150.  
  1151. H="_FillLibraryList"
  1152. ;Clear variable in case it has been used previously
  1153. ^!ClearVariable %LibraryList%
  1154. ;Retrieve first library name that matches specified search criteria
  1155. ^!Set %LibraryName%=^$GetFileFirst(^$GetLibraryPath$;"*.clb";Name)$
  1156. ^!IfTrue ^$IsEmpty(^%LibraryName%)$ End
  1157.  
  1158. :StartLoop
  1159. ;Append library name without path and extension to variable. Name is preceded with a space in case it starts with a special character. This space will have to be removed later
  1160. ^!Append %LibraryList%= ^$GetName("^%LibraryName%")$|
  1161. ;Get next matching library name and go back to start of loop
  1162. ^!Set %LibraryName%=^$GetFileNext$
  1163. ;If the library name variable contains text, continue the loop
  1164. ^!IfFalse ^$IsEmpty(^%LibraryName%)$ StartLoop
  1165.  
  1166. ;Close the file-find variable to restore system resources
  1167. ^!CloseFileFind
  1168.  
  1169. ;Get size of library list
  1170. ^!Set %SizeList%=^$StrSize("^%LibraryList%")$
  1171. ;Substract one from the SizeList value
  1172. ^!Dec %SizeList%
  1173. ;Format list so it can be used in Clip wizard
  1174. ^!Set %LibraryList%=^$StrCopy("^%LibraryList%";1;^%SizeList%)$
  1175.